<?php
namespace app\shop\library\pay;

class Pay{
    private $payment = [
        'wechat'=>WeChat::class,
    ];

    public static function instance(string $payment_way):Pay{
        $payment_way = strtolower($payment_way);

        if (isset(self::$payment[$payment_way])){
            return new self::$payment[$payment_way];
        }else{
            throw new \Exception('支付方式不存在');
        }
    }

    public function create($order_id,$price,$title){

    }

    public function close($order_id){
        return true;
    }

    public function refunds($order_id,$refund_order_id,$amount,$reason){
        return true;
    }

    protected function notify_url(){
        return \cubox\Cubox::url('shop','pay','notify');
    }
}